package com.payment.trans;

import com.payment.plugin.PaymentPlugin;
import com.payment.request.TransRequest;
import com.payment.service.PluginService;
import com.payment.util.PayTypeEnum;
import com.payment.vo.PayResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ClassName: AbstractTrans
 * @Description:
 * @author: fengcheng
 * @date: 2021/03/25
 */
@Slf4j
@Component("transPay")
public  class AbstractPayTrans extends AbstractTrans {

    @Autowired
    private PluginService pluginService;

    @Override
    public PayResult execute(TransRequest request) {
        PaymentPlugin paymentPlugin = pluginService.getPaymentPlugin(PayTypeEnum.HANG_ZHOU_BANK_ALI_PAY_PLUGIN.getCode());
        PayResult result = new PayResult();
        paymentPlugin.pay(request);
        return result;
    }

}
